Skip to content

fix(agents): 搜索命中带上所在文件的 generation 与 readBytes - #241

Merged
xiaoyumuxi merged 4 commits into
mainfrom
fix/agent-search-hit-generation
Dec 1, 2026
Merged

xiaoyumuxi merged 4 commits into
mainfrom
fix/agent-search-hit-generation

Conversation

@xiaoyumuxi

Copy link
Copy Markdown
Contributor

关联 Issue

Refs 1lck/Lithe-IDEA#2491

问题与修复

#240 让 agentSessions.page 必须带上 generation,但 generation 只在 agentSessions.list 的会话上给出,而且是会话主文件的值。搜索命中可能落在子代理文件里,宿主拿不到该文件的 generation,从命中处分页读取会一直回答 changed。

  • agentSessions.search 的每个命中新增 generation 和 readBytes,都是命中所在文件的值(files.generation 与 files.cursor_offset)。
  • 契约 README 与协议更新记录同步说明;测试覆盖两个字段的取值,重建一致性测试比较时把各自随机的 generation 置零。

API 与兼容性

原计划编号 方法 / 扩展 用途
API-45 内部命令 agentSessions.search 的命中新增 generation、readBytes 宿主从命中处分页读取所在文件(可能是子代理文件)

只新增回答字段,在 agents 0 内;旧宿主忽略即可。没有新增宿主方法、通知、错误码或能力版本,插件与 SDK 不受影响。

验证

  • cargo test -p lithe-agent-sessions -p lithe-agent-runtime:45 + 36 项通过。
  • cargo clippy -p lithe-agent-sessions --all-targets -D warnings、cargo fmt:通过。
  • node shared/plugins/scripts/verify-docs.mjs:通过。

命中可能在子代理文件里,宿主分页读取该文件需要它自己的 generation 和
已读字节数,列表只给主文件的值。
@xiaoyumuxi
xiaoyumuxi marked this pull request as ready for review December 1, 2026 04:32
@xiaoyumuxi
xiaoyumuxi merged commit e9091a2 into main Dec 1, 2026
7 of 8 checks passed

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Devin Review: 2 flags

Not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)

Devin Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant